#include <stdio.h>

int main() {
	int f(int n);
	int n = 0, t;
	scanf("%d", &t);
	while (f(n) <= t)
		n++;
	printf("%d", f(n));
}

int f(int n) {
	int f0 = 0, f1 = 1, f, i;
	if (n == 0)
		f = 0;
	else if (n == 1)
		f = 1;
	else {
		for (i = 2; i <= n; i++) {
			f = f0 + f1;
			f0 = f1;
			f1 = f;
		}
	}
	return f;
}
